import lzma

data_in = b"""this is a test; Insert Data Here;
this is a test; Insert Data Here;
this is a test; Insert Data Here;
"""

data_out = lzma.compress(data_in)
print("压缩比:", len(data_out) / len(data_in))
'压缩比: 0.98'  # 压缩比不高

data_decompress = lzma.decompress(data_out)
print("压缩,解压后数据是否一致:",data_decompress == data_in)
'缩,解压后数据是否一致: True'